<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<a href="${pageContext.request.contextPath}/login.html">登录页面</a>
<br/><br/>
<a href="${pageContext.request.contextPath}/register.html">注册页面</a>
<br/><br/>

上传<br/>
	<form action="${pageContext.request.contextPath}/file/upload" method="post" enctype="multipart/form-data">
		<input type="text" name="username"/>
		<br/><br/>
		<input type="text" name="password"/>
		<br/><br/>
		<input type="file" name="file"/>
		<br/><br/>
		<input type="submit" value="提交">
	</form>
	
	
	<br/>
	<img alt="" src="${pageContext.request.contextPath}/file/show?fileName=${fileName }">
	<br/>
	<c:choose>
		<c:when test="${fileName != null}">
			<a href="${pageContext.request.contextPath}/file/download?fileName=${fileName }"><img alt="" src="${pageContext.request.contextPath}/file/show?fileName=${fileName }"></a>
		</c:when>
		<c:otherwise>
			<a href="${pageContext.request.contextPath}/file/download?fileName=default.jpg"><img alt="" src="<%=basePath %>/upload/default.jpg"></a>
		</c:otherwise>
	</c:choose>
<hr/>
下载<br/>
<form action="${pageContext.request.contextPath}/file/download" method="get">
		<input type="text" name="fileName"/>
		<br/><br/>
		<input type="submit" value="提交">
	</form>
</body>
</html>